﻿@model PagingList<RoleDto>
@{
    ViewBag.ActiveMenu = "角色管理";
    ViewBag.Title = "角色管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            角色管理
            @*<small>角色管理</small>*@
        </h1>
        @*<ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">UI</a></li>
                <li class="active">General</li>
            </ol>*@
    </section>
    <section class="content">
        <div class="box box-default color-palette-box">
            @*<div class="box-header with-border">
            </div>*@
            <div class="box-body">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="table-responsive">
                            <table class="table table-striped table-hover">
                                <thead>
                                    <tr>
                                        <th>角色名称</th>
                                        <th>对外显示名称</th>
                                        <th>是否可删</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @if (Model != null && Model.Count > 0)
                                    {
                                        int num = 1;
                                        foreach (var item in Model)
                                        {
                                            num++;
                                            <tr>
                                                <td>@item.Name</td>
                                                <td>
                                                    @item.DisplayName
                                                    @if (item.IsDefault)
                                                    {
                                                        <i title="默认角色" class="fa fa-star fa-color-red"></i>
                                                    }
                                                </td>
                                                <td><i class="@(!item.IsStatic ? "fa fa-check-circle fa-color-green" : "fa fa-times-circle fa-color-red")"></i></td>
                                                <td>@item.CreatedTime.ToString("yyyy-MM-dd")</td>
                                                <td>
                                                    <div class="@(num >= Model.Count && num>2 ? "dropup" : "dropdown")">
                                                        <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                                                            操作
                                                            <span class="caret"></span>
                                                        </button>
                                                        <ul class="dropdown-menu" style="min-width:80px;">
                                                            <li><a href="#">编辑</a></li>
                                                            @if (!item.IsStatic)
                                                            {
                                                                <li><a href="#">删除</a></li>
                                                            }
                                                            <li>
                                                                <a href="javascript:;" data-href="@Url.Action(MVC.Admin.AdminUser.ChangePermissions(item.Id))" plugin="dialog" title="权限设置 - @(item.DisplayName)">权限</a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </td>
                                            </tr>
                                        }
                                    }
                                </tbody>
                            </table>
                            @Html.PagingButton(Model, PaginationMode.NumericNextPrevious, 3)
                        </div>
                    </div>
                </div>
            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </section><!-- /.content -->
</div>

